package com.wordpress.standal.multimethod.examples.project

import com.wordpress.standal.multimethod.api.class1.MultiMethod

object RiskCalculation {
  
  def main(args : Array[String]) : Unit = {
    
    val calculateRisk = MultiMethod[Project, Double]
    
    calculateRisk.add(classOf[HourlyProject], (p: HourlyProject) => 0.0)
    calculateRisk.add(classOf[FixedPriceProject], (p: FixedPriceProject) => p.fixedPrice * 3.14)
    
    val projects = List(new HourlyProject, new FixedPriceProject(5000), new InternalProject)

    for (p: Project <- projects) {
      println(calculateRisk(p))
    }
    
  }

}
